package top.littlejiang.onlinexam.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.littlejiang.onlinexam.common.base.BasePage;
import top.littlejiang.onlinexam.common.utils.Result;
import top.littlejiang.onlinexam.entity.OlexamProctorLog;
import top.littlejiang.onlinexam.service.OlexamProctorLogService;

/**
 * @author chen
 * @Description
 * @since 2021/3/16 10:58
 */
@Controller
@RequestMapping("/proctorlog")
public class ProctorLogController {

    @Autowired
    OlexamProctorLogService proctorLogService;

    /**
     * 分页查询
     * @param page
     * @return
     */
    @PostMapping("/loglist")
    @ResponseBody
    public Result logList(@RequestBody BasePage<OlexamProctorLog> page) {
        return Result.ok(proctorLogService.getlogListPage(page));
    }

    /**
     * 上传一条数据
     * @param log
     * @return
     */
    @PostMapping("/insertone")
    @ResponseBody
    public Result insertOne(@RequestBody OlexamProctorLog log){
        proctorLogService.insertOne(log);
        return Result.ok();
    }
}
